<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="/resource/common/taglib.jspf"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>添加</title>
	<%@include file="/resource/common/jquery.jspf"%>
	<%@include file="/resource/common/bootstrap.jspf"%>
	<%@include file="/resource/common/validate.jspf"%>
	<%@include file="/resource/common/kindeditor.jspf"%>
	<%@include file="/resource/common/ztree.jspf"%>
	<%@include file="/resource/common/wdate-picker.jspf"%>
	<link rel="stylesheet" href="${ctxStatic}/plugins/upload/image.css" type="text/css" media="screen" />
	<link rel="stylesheet" href="${ctxStatic}/plugins/city-picker/dist/css/city-picker.css" type="text/css" media="screen" />
	<script type="text/javascript" src="${ctxStatic }/js/system/asyncDoSubmitForm.js"></script>
	<script type="text/javascript" src="${ctxStatic }/plugins/upload/uploadImageUtils.js"></script>
	<script type="text/javascript" src="${ctxStatic }/plugins/city-picker/dist/js/city-picker.data.min.js"></script>
	<script type="text/javascript" src="${ctxStatic }/plugins/city-picker/dist/js/city-picker.min.js"></script>
	<style type="text/css">
		.checkbox_label{
			font-weight: 500 !important;
			margin-right: 10px !important;
			margin-left: 10px !important;
		}
	</style>
</head>
<body>
	<div id="body-wrapper">
		<div id="main-content">
			<div class="content-box" >
				<div class="content-box-content">
					<div class="tab-content default-tab" id="tab1">
						<fieldset>
							<input type="hidden" id="asyncResult" name="asyncResult" value="-1" /> 
							<input type="hidden" id="asyncResultData" name="asyncResultData" value="-1" /> 
							<input type="hidden" id="asyncResultError" name="asyncResultError" value="-1" />
							<form:form id="inputForm" name="form1" class="form-horizontal" method="post" action="addWebUser.do" modelAttribute="WebUser">
								<div class="row">
									<div class="col-md-6 col-sm-6 col-xs-6" >
										<input type="hidden" id="userId" name="userId" value="${entity.userId}" />
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">手机:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.phone}" name="phone" id="phone"  placeholder="手机" readonly="readonly"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">名字:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.name}" name="name" id="name"  placeholder="名字"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">微信:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.weixin}" name="weixin" id="weixin"  placeholder="微信号"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">QQ:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.qq}" name="qq" id="qq"  placeholder="qq"/>
											</div>
										</div>

										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">省/市/区:</label>
											<div class="col-md-10 col-sm-10 col-xs-10" style="position:relative;">
												<input type="text" class="form-control input-sm" id="region" name="region" value="${entity.province}/${entity.city}/${entity.area}"  data-toggle="city-picker" readonly="readonly"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">详细地址:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.address}" name="address" id="address"  placeholder="详细地址"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">出生日期:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="<fmt:formatDate value="${entity.birthdate}" pattern="yyyy-MM-dd" />" onfocus="dateUtils.show_YMD(0,'birthdate')"  name="birthdate" id="birthdate"  placeholder="出生日期"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">婚姻:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<select name="marital" id="marital" class="form-control input-sm">
													<option value="0" <c:if test="${entity.marital==0 }">selected="selected"</c:if>>保密</option>
													<option value="1" <c:if test="${entity.marital==1 }">selected="selected"</c:if>>已婚</option>
													<option value="2" <c:if test="${entity.marital==2 }">selected="selected"</c:if>>未婚</option>
													<option value="3" <c:if test="${entity.marital==3 }">selected="selected"</c:if>>离异</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">年收入:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.income}" name="income" id="income"  placeholder="年收入"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">职称:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.jobTitle}" name="jobTitle" id="jobTitle"  placeholder="职称"/>
											</div>
										</div>
									</div>
									<div class="col-md-6 col-sm-6 col-xs-6" >
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">行业:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.jobType}" name="jobType" id="jobType"  placeholder="工作行业"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">性别:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<select name="sex" id="sex" class="form-control input-sm">
													<option value="0" <c:if test="${entity.sex==0 }">selected="selected"</c:if>>女</option>
													<option value="1" <c:if test="${entity.sex==1 }">selected="selected"</c:if>>男</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">邮箱:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="text" class="form-control input-sm" value="${entity.email}" name="email" id="email"  placeholder="邮箱"/>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">状态:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<select name="status" id="status" class="form-control input-sm">
													<option value="true" <c:if test="${entity.status==true }">selected="selected"</c:if>>开启</option>
													<option value="false" <c:if test="${entity.status==false }">selected="selected"</c:if>>关闭</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-2 col-sm-2 col-xs-2 control-label">图片:</label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input type="hidden" id="photo" name="photo" value="${entity.photo }"/>
												<input type="hidden" id="filedata" name="filedata" />
												<input type="hidden" id="fileext" name="fileext" />
												<div id="uploadPreview" class="uploadPreview">
													5M大小以内
												</div>
											</div>
										</div>
										<div class="form-group form-group-sm">
											<label for="formGroupInputSmall" class="col-md-2 col-sm-2 col-xs-2 control-label"></label>
											<div class="col-md-10 col-sm-10 col-xs-10">
												<input id="uploadImage" type="file" name="photoimage" class="fimg1" />
											</div>
										</div>
										<div  style="color: red;text-align: center;margin-bottom: 10px;margin-left: -150px;" id="msg"></div>
									</div>
								</div>

								<div class="row">
									<div class="col-md-12 col-sm-12 col-xs-12" >
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">投资目的:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${investment_objective_list}" varStatus="abc">
													<label><input type="checkbox" name="investmentObjective" class="checkbox_label" <c:if test="${fn:contains(entity.investmentObjective, item.name)}"> checked="checked"</c:if> value="${item.name}">${item.name}</label>
												</c:forEach>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">资金来源:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${capital_source_list}" varStatus="abc">
													<label><input type="checkbox" name="capitalSource" class="checkbox_label" <c:if test="${fn:contains(entity.capitalSource, item.name)}"> checked="checked"</c:if> value="${item.name}">${item.name}</label>
												</c:forEach>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">房型倾向:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${tendency_room_list}" varStatus="abc">
													<label><input type="checkbox" name="tendencyRoom" class="checkbox_label" <c:if test="${fn:contains(entity.tendencyRoom, item.name)}"> checked="checked"</c:if> value="${item.name}">${item.name}</label>
												</c:forEach>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">地点倾向:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${city_list}" varStatus="abc">
													<label><input type="checkbox" name="tendencySite" class="checkbox_label" <c:if test="${fn:contains(entity.tendencySite, item.chineseName)}"> checked="checked"</c:if> value="${item.chineseName}">${item.chineseName}</label>
												</c:forEach>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">价格倾向:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${tendency_price_list}" varStatus="abc">
													<label><input type="checkbox" name="tendencyPrice" class="checkbox_label" <c:if test="${fn:contains(entity.tendencyPrice, item.name)}"> checked="checked"</c:if> value="${item.name}">${item.name}</label>
												</c:forEach>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">面积倾向:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${tendency_size_list}" varStatus="abc">
													<label><input type="checkbox" name="tendencySize" class="checkbox_label" <c:if test="${fn:contains(entity.tendencySize, item.name)}"> checked="checked"</c:if> value="${item.name}">${item.name}</label>
												</c:forEach>
											</div>
										</div>
										<div class="form-group">
											<label class="col-md-1 col-sm-1 col-xs-1 control-label">学校倾向:</label>
											<div class="col-md-11 col-sm-11 col-xs-11">
												<c:forEach var="item" items="${tendency_school_list}" varStatus="abc">
													<label><input type="checkbox" name="tendencySchool" class="checkbox_label" <c:if test="${fn:contains(entity.tendencySchool, item.name)}"> checked="checked"</c:if> value="${item.name}">${item.name}</label>
												</c:forEach>
											</div>
										</div>
									</div>
								</div>
							</form:form>
						</fieldset>
					</div>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript">
var result = 0;
var validateForm;
$(document).ready(function() {
	validateForm = $("#inputForm").validate({
		rules : {
			name : {
				required : true
			},
			investmentObjective : {
				required : true
			},
			capitalSource : {
				required : true
			},
			tendencyRoom : {
				required : true
			},
			tendencySite : {
				required : true
			},
			tendencyPrice : {
				required : true
			},
			tendencySize : {
				required : true
			},
			tendencySchool : {
				required : true
			},
			marital : {
				required : true
			},
			sex : {
				required : true
			},
			email : {
				email:true
			},
			status : {
				required : true
			}
		},
		messages : {
			name : {
				required : "名字不能为空"
			},
			investmentObjective : {
				required : "投资目的不能为空"
			},
			capitalSource : {
				required : "资金来源，国内资金，海外资金不能为空"
			},
			tendencyRoom : {
				required : "房型倾向不能为空"
			},
			tendencySite : {
				required : "地点倾向不能为空"
			},
			tendencyPrice : {
				required : "价格倾向不能为空"
			},
			tendencySize : {
				required : "面积倾向不能为空"
			},
			tendencySchool : {
				required : "学校倾向不能为空"
			},
			marital : {
				required : "婚姻不能为空"
			},
			sex : {
				required : "性别不能为空"
			},
			email : {
				email:"邮箱格式不正确"
			},
			status : {
				required : "状态，0关闭，1开启不能为空"
			}
		},
		errorElement : "em",
		errorClass : "validate_error",
		submitHandler: function(form) { //通过之后回调
		},
		invalidHandler: function(form, validator) {
			return false;
		}
	});

    $("#uploadImage").imageUploadUtils({
        data : "#filedata",
        ext : "#fileext",
        msg : "#msg",
        preview : "#uploadPreview",
    });

    var photo = "${entity.photo}";
    var bg = "resource/images/no_photo.png";
    if(photo!=''){
        bg = photo;
    }
    $("#uploadPreview").css("background-image", "url("+bg+")");
});

</script>	
</body>
</html>